package cn.gson.crm.controller.pay;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.StudentDetailDao;
import cn.gson.crm.model.dao.StudentPayDao;
import cn.gson.crm.model.entity.StudentDetail;
import cn.gson.crm.model.po.StudentPayPo;

@WebServlet("/student/payed")
public class PayedStudentServlet extends BaseServlet {
	private StudentPayDao stuPayDao = new StudentPayDao();
	/**
	 * 已缴清学费的学员
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String p = request.getParameter("page");
		String name = request.getParameter("name");
		if (p == null || p.isEmpty()) {
			p = "1";
		}
		Integer page = Integer.parseInt(p);
		// 获取交清学费的学员
		List<StudentPayPo> stuList = stuPayDao.getStudentList(page, "正常", "已分配", name, 2);
		int totalPage = stuPayDao.getTotalPage("正常", "已分配", name, 2);
		request.setAttribute("page", page);
		request.setAttribute("stuList", stuList);
		request.setAttribute("totalPage", totalPage);
		request.setAttribute("queryString", noPageQueryString(request));
		getServletPathAndForward(request, "pay/student_pay.jsp");
	}
}
